#coding=utf-8
import redis
import os
import ConfigParser

class masterRedis:
    def __init__(self):
        config=ConfigParser.ConfigParser()
        path=os.path.split(os.path.realpath(__file__))[0] + '/config.conf'
        config.read(path)
        ip=config.get("originalredis","ip")
        port=config.get("originalredis","port")
        db=config.get("originalredis","db")
        self.redis=redis.Redis(host=ip,port=port,db=db)

    def getUrl(self):
        try:
            return self.redis.brpop("masterurl", 0)
        except Exception:
            print "failed put links"